#include <iostream>
using std::cout;
using std::endl;

int gNum = 100;

class Point
{
public:
    Point()
    : _ix(0)
    , _iy(0)
    , _ref(_ix)
    {
        cout << "Point()" << endl;
    }

    Point(int x,int y)
    : _ix(x)
    , _iy(y)
    , _ref(_ix)//int & ref = _ix;
    /* , _ref(z) */
    /* , _ref(gNum) */
    {
        /* &z; */
        /* cout << _ref << endl; */
        cout << "Point(int,int)" << endl;
    }

    Point(const Point & rhs)
    : _ix(rhs._ix)
    , _iy(rhs._iy)
    , _ref(rhs._ref)
    {
        /* cout << "拷贝构造" << endl; */
    }

    Point & operator=(const Point & rhs){
        /* cout << "赋值运算符函数" << endl; */
        _ix = rhs._ix;
        _iy = rhs._iy;
        _ref = rhs._ref;
        return *this;
    }

    void print(){
        cout << "(" << _ix
            << "," << _iy
            << "," << _ref
            << ")" << endl;
    }
private:
    int _ix;
    int _iy;
    int & _ref = gNum;
};

void test0(){
    Point pt(5,6);
    Point pt2(3,9);
    pt.print();
    pt2.print();
}

int main(void){
    test0();
    return 0;
}
